<?php
	include_once 'isLogin.php';
	$infoc=new info();
	$table_info = 'info';  	  		 	  //咨询表
	$table_info_label = 'info_label';  	  //咨询标签关联表表
	$id=$_GET['id'];

	//修改
	if($id!='' && $id!=null){
		$row=$infoc->info($id);

		$class=$commonc->getInfo("info_class",$row['class_id']);
		$row['class_name']=$class['class_name'];

		//读取标签
		$select_label=$commonc->getList($table_info_label." WHERE info_id=".$row['id']." ORDER BY label_id");
		$select_label=$select_label['result'];

		if (is_array($select_label)) {
		 	foreach ($select_label as $k1 => $v1) {
		 		$label_id.=$v1['label_id'].",";	
		 	}
		 	$label_id=substr($label_id,0,-1);
			$label_list=$commonc->getList("label WHERE id in(".$label_id.")");

			$smarty->assign('label_list',$label_list['result']);
		}

		$smarty->assign('row',$row);
	}

	//读取分类
	$info_class=$infoc->info_class_list();
	$smarty->assign('info_class',$info_class['result']);

	//读取标签
	$label=$infoc->label_list();
	$smarty->assign('label',$label['result']);
	
	$smarty->display("info_info.html");
?>